//
//  KDDetailReportController.m
//  WangJingApp
//
//  Created by 魏强 on 17/11/6.
//  Copyright © 2017年 KDTech. All rights reserved.
//

#import "KDDetailReportController.h"
#import "KDWorkingReportTool.h"
#import "KDGetWorkingReportParam.h"
@interface KDDetailReportController ()
@property (weak, nonatomic) IBOutlet UILabel *titleLb;
@property (weak, nonatomic) IBOutlet UILabel *timeLb;
@property (weak, nonatomic) IBOutlet UIButton *firstStar;
@property (weak, nonatomic) IBOutlet UIButton *secondStar;
@property (weak, nonatomic) IBOutlet UIButton *thirdStar;
@property (weak, nonatomic) IBOutlet UILabel *secondTitleLb;
@property (weak, nonatomic) IBOutlet UILabel *contentLb;

@end

@implementation KDDetailReportController
#pragma mark - 懒加载区

#pragma mark - 生命周期区
- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadData];
}
#pragma mark - 板块布置区
- (void)reloadView{
    self.titleLb.text = self.model.title;
    self.timeLb.text = self.model.update_dt;
    self.secondTitleLb.text = self.model.subtitle;
    self.contentLb.text = self.model.content;
    switch (self.model.star) {
        case 0:
            self.firstStar.selected = NO;
            self.secondStar.selected = NO;
            self.thirdStar.selected = NO;
            break;
        case 1:
            self.firstStar.selected = YES;
            self.secondStar.selected = NO;
            self.thirdStar.selected = NO;
            break;
        case 2:
            self.firstStar.selected = YES;
            self.secondStar.selected = YES;
            self.thirdStar.selected = NO;
            break;
        case 3:
            self.firstStar.selected = YES;
            self.secondStar.selected = YES;
            self.thirdStar.selected = YES;
            break;
            
        default:
            break;
    }
}
#pragma mark - 事件点击区
- (void)loadData{
    WS(ws);
    KDGetWorkingReportParam *param = [[KDGetWorkingReportParam alloc]init];
    param.method = @"report/getReportLogsById";
    param.ID = [NSString stringWithFormat:@"%ld",(long)self.model.ID];
    [KDWorkingReportTool getWorkingReportWithParam:param success:^(KDBaseResult *responseObejct) {
        if ([responseObejct.code isEqualToString:@"1"]) {
            ws.model = [KDWorkingReportModel objectWithKeyValues:responseObejct.data[@"report"]];
            [ws reloadView];
        }else{
            [SVProgressHUD showErrorWithStatus:responseObejct.msg maskType:SVProgressHUDMaskTypeGradient];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"网络错误" maskType:SVProgressHUDMaskTypeGradient];
    }];
}
#pragma mark - 网络请求区

#pragma mark - 通知接收区


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
